import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class Test {
    public static void main(String[] args) {
        ExecutorService service =
                new ThreadPoolExecutor(5,10,1, TimeUnit.SECONDS, new ArrayBlockingQueue<>(20), new ThreadPoolExecutor.DiscardOldestPolicy());
        for (int i = 0; i < 30; i++) {
            int id = i;
            service.submit(new Runnable() {
                @Override
                public void run() {
                    System.out.println(id);
                }
            });
        }
    }
}
/*
class Solution {
    public int rob(TreeNode root) {
        int[] ans = robTree(root);
        return Math.max(ans[0],ans[1]);
    }
    */
/**
     dp[0]:不选
     dp[1]:选
     *//*

    public int[] robTree(TreeNode root){
        if(root == null) return new int[]{0,0};
        int[] leftdp = robTree(root.left);
        int[] rightdp = robTree(root.right);
        int val1 = root.val + leftdp[0] + rightdp[0];//选
        int val2 = Math.max(leftdp[0],leftdp[1])+Math.max(rightdp[0],rightdp[1]);//不选
        return new int[]{val2,val1};
    }
}
*/
